<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport"
        content="width=device-width, initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0,user-scalable=no">
    <title>背景缩放</title>
    <style>
        div {
            width: 500px;
            height: 500px;
            border: 2px solid #000;
            background: url(images/dog.jpg) no-repeat;
            background-size: 500px;
        }

        div:nth-child(2) {
            width: 50px;
            height: 50px;
            border: 1px solid #000;
            background: url(images/apple100.jpg);
            background-size: 50px 50px;
        }
    </style>
</head>

<body>
    <div></div>
    <div></div>
</body>

</html>